import 'package:lepig/common/config/theme.dart';
import 'package:lepig/common/config/theme.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class MyTeam extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _MyTeam();
  }
}

class _MyTeam extends State<MyTeam> with  SingleTickerProviderStateMixin {

  List<String> Tabs = [
    "今日新增",
    "昨日新增",
    "一级粉丝",
    "二级粉丝",
  
  ];
  TabController _tabController;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    _tabController = TabController(length: Tabs.length, vsync: this);
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        elevation: 0,
        title: new Text("我的团队"),
      ),

      body: new Column(
        children: <Widget>[
          new Container(
            width: double.infinity,
            child: new Column(
              children: <Widget>[
                new Text("我的推荐人",style: TextStyle(
                  fontSize: 18.0,
                ),),
                new Padding(
                  child:  new Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      new ClipOval(
                        child: new Image.network("http://thirdwx.qlogo.cn/mmopen/vi_32/Zfg5ia3wNE5Cx80XVMQ55lcblElktP7q4ibIlmbyupOhZuTe9hosfojbhMSKPSmoKy5M18LIVfWmY8mbicRB955ibw/132",width: 50.0,),
                      ),
                      new SizedBox(width: 20.0,),
                      new Text("实际1您",style: TextStyle(
                        fontSize: 20.0
                      ),)
                    ],
                  ),
                  padding: EdgeInsets.all(20.0),
                )
              ],
            ),
            height: 150,
            color: curColor
          ),
          new Container(
            child: new TabBar(
              controller: _tabController,
              tabs: Tabs.map((e){
                return new Tab(
                  child: new Text(e),
                );
              }).toList(),
            ),
            width: double.infinity,
          ),
          Expanded(
            child:  new Container(
              color: curBgColor,
              child: _tabsView(),
            ),
          )
        ],
      ),
    );
  }

  Widget _tabsView(){
     return TabBarView(
      controller: _tabController,
      children: Tabs.map((type) {
        //创建3个Tab页
        return _tabCard(type);
      }).toList(),
    );
  }
  Widget _tabCard(i) {
    return new ListView(
      children: <Widget>[
        _item(),
        _item(),
      ],
    );
  }
  Widget _item() {
    return new Container(
      child: new Column(
        children: <Widget>[
          new Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              new ClipOval(
                child: new Image.network("http://thirdwx.qlogo.cn/mmopen/vi_32/Zfg5ia3wNE5Cx80XVMQ55lcblElktP7q4ibIlmbyupOhZuTe9hosfojbhMSKPSmoKy5M18LIVfWmY8mbicRB955ibw/132",width: 50.0,),
              ),
              new SizedBox(width: 20.0,),
              new Column(
                mainAxisAlignment: MainAxisAlignment.end,
                crossAxisAlignment: CrossAxisAlignment.end,
                children: <Widget>[
                  new Text("实际1您",style: TextStyle(
                      fontSize: 15.0
                  ),),
                  new SizedBox(height: 10.0,),
                  new Text("2018-25-10 20:35:45",style: TextStyle(
                    color: curFontBgColor
                  ),)
                ],
              )
            ],
          )
        ],
      ),
      padding: EdgeInsets.only(left: 20.0,right: 20.0,top: 10.0,bottom: 10.0),
      margin: EdgeInsets.only(top: 20,bottom: 0.0),
      decoration: BoxDecoration(
        color: Colors.white,

      ),
    );
  }

}
